Rhapsody Developer Release Copyright 1997 by Apple Computer, Inc. All Rights Reserved.
These notes concern developer documentation for Rhapsody and the delivery of this documentation.
initWithFile:
begins in this way in t:he book:
- initWithFile:(NSString *)aFile { NSEnumerator *dayenum; NSDate *itemDate; [super init]; if (aFile) { activeDays = [NSUnarchiver unarchiveObjectWithFile:aFile]; if (activeDays) activeDays = [activeDays retain]; else { NSRunAlertPanel(@"To Do", @"Couldn't unarchive file %@", nil, nil, nil, aFile); return nil; } } else { activeDays = [[NSMutableDictionary alloc] init]; [self setCurrentItems:nil]; } if (![NSBundle loadNibNamed:@"ToDoDoc.nib" owner:self] ) return nil; /* etc. ... */
Corrected, the code example should read as follows:
- initWithFile:(NSString *)aFile { NSEnumerator *dayenum; NSDate *itemDate; [super init]; if (![NSBundle loadNibNamed:@"ToDoDoc.nib" owner:self] ) return nil; if (aFile) { activeDays = [NSUnarchiver unarchiveObjectWithFile:aFile]; if (activeDays) activeDays = [activeDays retain]; else { NSRunAlertPanel(@"To Do", @"Couldn't unarchive file %@", nil, nil, nil, aFile); return nil; } } else { activeDays = [[NSMutableDictionary alloc] init]; [self setCurrentItems:nil]; } /* etc. ... */
In other words, the statement that loads the nib file should
should come right after the invocation of super
.